import React, { Component } from 'react';
import '../styles/MySecKill.scss'
import * as service from '../api/index'


class MySecKill extends Component {
    constructor(props){
        super(props);
        this.state = { 
            list:[]
        }
    }
    async componentDidMount(){
        var res=await service.index_goodlist({page:1,count:10})
        this.setState({list:res.data.list})
    }
    render() {
        console.log(this.state.list);
        return (
            <div className='kill'>
                {
                    this.state.list.map((item,index)=>{
                        return (
                            <div className="item" key={index}>
                                <div className='tu'><img src={item.pic} alt="" /></div>
                                <div className="text">{item.name}</div>
                                <div className="yuanjia">{item.brand}</div>
                                <div className="jia">{item.brandEN}</div>
                                <div className="jia">
                                    <span>{item.salesPrice.name}：</span>
                                    <span>{item.salesPrice.value}</span>
                                </div>
                                
                                <div className='activityTags'>
                                    {item.activityTags.map((item1,index1)=>{
                                        return (
                                            <span className='item1' key={index1}>
                                               {item1} 
                                            </span>
                                        )
                                    })
                                    }
                                </div>
                                <div className='effectList'>
                                    {item.effectList.map((item2,index2)=>{
                                        return (
                                            <span className='item2' key={index2}>
                                               {item2} 
                                            </span>
                                        )
                                    })
                                    }
                                </div>
                            </div>
                        )
                    })
                }
            </div>
        );
    }
}

export default MySecKill;